package views;

import views.panels.PanelGeneral;
import logicBusiness.AreaBL;
import logicBusiness.AsignaturaBL;
import logicBusiness.EstudianteBL;
import models.Estudiante;
import java.awt.BorderLayout;
import java.util.StringTokenizer;
import java.util.Vector;
import javax.swing.DefaultComboBoxModel;
import javax.swing.ImageIcon;
import javax.swing.JOptionPane;

/**
 *
 * @author viviana
 */
public class InterfazEditarEstudiante extends javax.swing. JInternalFrame {

    private final ImageIcon icono;
    //se necesita guerdar este valor para encontrar luego de modificar los datos al estudiante
    long documentoestudiante;
    EstudianteBL estudiantebo;
    AreaBL areabo;
    AsignaturaBL asignaturabo;
    Vector vecestudiantes;
    Vector vecareas;

    /** Creates new form InterfazEditarEstudiante */
    public InterfazEditarEstudiante() {
        initComponents();

        estudiantebo = new EstudianteBL();
        areabo = new AreaBL();
//        vecestudiantes = new Vector(estudiantebo.obtenerListadoPreinscritos());
        this.CBSelecEstudiante.setModel(new DefaultComboBoxModel(vecestudiantes));
        PanelGeneral panel = new PanelGeneral();
        this.add(panel, BorderLayout.SOUTH);
        icono = new ImageIcon(getClass().getResource("/Imagenes/icon.gif"));
      //  this.setIconImage(icono.getImage());
        //inicializacion de combobox estudiantes


    }

    /** This method is called from within the constructor to
     * initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is
     * always regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        BCancelar = new javax.swing.JButton();
        jTabbedPane1 = new javax.swing.JTabbedPane();
        PanelDatosEstudiante = new javax.swing.JPanel();
        jLabel15 = new javax.swing.JLabel();
        BRegistrarCambios = new javax.swing.JButton();
        jLabel1 = new javax.swing.JLabel();
        jLabel16 = new javax.swing.JLabel();
        jLabel17 = new javax.swing.JLabel();
        jLabel18 = new javax.swing.JLabel();
        CTNomEstudiante = new javax.swing.JTextField();
        CTApellidoEstudiante = new javax.swing.JTextField();
        CTTelefonoEstudiante = new javax.swing.JTextField();
        jLabel19 = new javax.swing.JLabel();
        CBMes = new javax.swing.JComboBox();
        jLabel20 = new javax.swing.JLabel();
        jLabel21 = new javax.swing.JLabel();
        CTDireccionEstudiante = new javax.swing.JTextField();
        jLabel24 = new javax.swing.JLabel();
        jLabel25 = new javax.swing.JLabel();
        CTDNIEstudiante = new javax.swing.JTextField();
        CBAno = new javax.swing.JComboBox();
        CBDia = new javax.swing.JComboBox();
        PanelGeneralDatos = new javax.swing.JPanel();
        PanelDatosMadre = new javax.swing.JPanel();
        jLabel10 = new javax.swing.JLabel();
        CTNomMadre = new javax.swing.JTextField();
        jLabel11 = new javax.swing.JLabel();
        CTApellidosMadre = new javax.swing.JTextField();
        jLabel12 = new javax.swing.JLabel();
        CTDNIMadre = new javax.swing.JTextField();
        jLabel13 = new javax.swing.JLabel();
        CTTelefonoMadre = new javax.swing.JTextField();
        BRegistrarMadre = new javax.swing.JButton();
        PanelDatosPadre = new javax.swing.JPanel();
        jLabel6 = new javax.swing.JLabel();
        CTNomPadre = new javax.swing.JTextField();
        jLabel7 = new javax.swing.JLabel();
        CTApellidosPadre = new javax.swing.JTextField();
        jLabel8 = new javax.swing.JLabel();
        CTDNIPadre = new javax.swing.JTextField();
        jLabel9 = new javax.swing.JLabel();
        CTTelefonoPadre = new javax.swing.JTextField();
        BRegistrarPadre = new javax.swing.JButton();
        jLabel5 = new javax.swing.JLabel();
        CBSelecEstudiante = new javax.swing.JComboBox();
        jLabel14 = new javax.swing.JLabel();
        jLabel23 = new javax.swing.JLabel();
        BDeshacer = new javax.swing.JButton();

        setTitle("Editar datos de estudiante");
        setResizable(false);

        BCancelar.setFont(new java.awt.Font("Tahoma", 1, 11)); // NOI18N
        BCancelar.setText("Cancelar");
        BCancelar.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                BCancelarActionPerformed(evt);
            }
        });

        PanelDatosEstudiante.setBorder(javax.swing.BorderFactory.createTitledBorder(null, "Datos personales", javax.swing.border.TitledBorder.DEFAULT_JUSTIFICATION, javax.swing.border.TitledBorder.DEFAULT_POSITION, new java.awt.Font("Tahoma", 0, 11), new java.awt.Color(0, 0, 153))); // NOI18N
        PanelDatosEstudiante.setFont(new java.awt.Font("Tahoma", 1, 11)); // NOI18N

        jLabel15.setText("Dirección del Estudiante:");

        BRegistrarCambios.setFont(new java.awt.Font("Tahoma", 1, 11)); // NOI18N
        BRegistrarCambios.setText("Registrar Modificaciones");
        BRegistrarCambios.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                BRegistrarCambiosActionPerformed(evt);
            }
        });

        jLabel1.setText("Nombre:");

        jLabel16.setText("Apellido:");

        jLabel17.setText("Teléfono:");

        jLabel18.setText("Fecha de nacimiento:");

        jLabel19.setText("Año:");

        CBMes.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "Enero", "Febrero", "Marzo", "Abril", "Mayo", "Junio", "Julio", "Agosto", "Septiembre", "Octubre", "Noviembre", "Diciembre" }));

        jLabel20.setText("Mes:");

        jLabel21.setText("Día:");

        CTDireccionEstudiante.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                CTDireccionEstudianteActionPerformed(evt);
            }
        });

        jLabel25.setText("Documento de identidad:");

        CBAno.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "1900", "1901", "1902", "1903", "1904", "1905", "1906", "1907", "1908", "1909", "1910", "1911", "1912", "1913", "1914", "1915", "1916", "1917", "1918", "1919", "1920", "1921", "1922", "1923", "1924", "1925", "1926", "1927", "1928", "1929", "1930", "1931", "1932", "1933", "1934", "1935", "1936", "1937", "1938", "1939", "1940", "1941", "1942", "1943", "1944", "1945", "1946", "1947", "1948", "1949", "1950", "1951", "1952", "1953", "1954", "1955", "1956", "1957", "1958", "1959", "1960", "1961", "1962", "1963", "1964", "1965", "1966", "1967", "1968", "1969", "1970", "1971", "1972", "1973", "1974", "1975", "1976", "1977", "1978", "1979", "1980", "1981", "1982", "1983", "1984", "1985", "1986", "1987", "1988", "1989", "1990", "1991", "1992", "1993", "1994", "1995", "1996", "1997", "1998", "1999", "2000", "2001", "2002", "2003", "2004", "2005", "2006", "2007", "2008", "2009", "2010", "2011" }));

        CBDia.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "1", "2", "3", "4", "5", "6", "7", "8", "9", "10", "11", "12", "13", "14", "15", "16", "17", "18", "19", "20", "21", "22", "23", "24", "25", "26", "27", "28", "29", "30", "31" }));

        javax.swing.GroupLayout PanelDatosEstudianteLayout = new javax.swing.GroupLayout(PanelDatosEstudiante);
        PanelDatosEstudiante.setLayout(PanelDatosEstudianteLayout);
        PanelDatosEstudianteLayout.setHorizontalGroup(
            PanelDatosEstudianteLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(PanelDatosEstudianteLayout.createSequentialGroup()
                .addContainerGap()
                .addGroup(PanelDatosEstudianteLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(PanelDatosEstudianteLayout.createSequentialGroup()
                        .addGroup(PanelDatosEstudianteLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addGroup(PanelDatosEstudianteLayout.createSequentialGroup()
                                .addGap(120, 120, 120)
                                .addComponent(jLabel24, javax.swing.GroupLayout.DEFAULT_SIZE, 378, Short.MAX_VALUE)
                                .addGap(26, 26, 26))
                            .addGroup(PanelDatosEstudianteLayout.createSequentialGroup()
                                .addGroup(PanelDatosEstudianteLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                    .addComponent(jLabel15)
                                    .addComponent(jLabel18))
                                .addGroup(PanelDatosEstudianteLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                    .addGroup(PanelDatosEstudianteLayout.createSequentialGroup()
                                        .addGap(33, 33, 33)
                                        .addGroup(PanelDatosEstudianteLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                            .addComponent(CBAno, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                                            .addComponent(jLabel19))
                                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                        .addGroup(PanelDatosEstudianteLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                            .addComponent(CBMes, javax.swing.GroupLayout.PREFERRED_SIZE, 70, javax.swing.GroupLayout.PREFERRED_SIZE)
                                            .addComponent(jLabel20))
                                        .addGap(6, 6, 6)
                                        .addGroup(PanelDatosEstudianteLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                            .addComponent(jLabel21)
                                            .addComponent(CBDia, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)))
                                    .addGroup(PanelDatosEstudianteLayout.createSequentialGroup()
                                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                        .addComponent(CTDireccionEstudiante, javax.swing.GroupLayout.DEFAULT_SIZE, 402, Short.MAX_VALUE))))
                            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, PanelDatosEstudianteLayout.createSequentialGroup()
                                .addGroup(PanelDatosEstudianteLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                    .addComponent(jLabel1)
                                    .addComponent(jLabel16)
                                    .addComponent(jLabel17)
                                    .addComponent(jLabel25))
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                                .addGroup(PanelDatosEstudianteLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                                    .addComponent(CTDNIEstudiante)
                                    .addComponent(CTTelefonoEstudiante)
                                    .addComponent(CTApellidoEstudiante)
                                    .addComponent(CTNomEstudiante, javax.swing.GroupLayout.DEFAULT_SIZE, 400, Short.MAX_VALUE))))
                        .addGap(22, 22, 22))
                    .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, PanelDatosEstudianteLayout.createSequentialGroup()
                        .addComponent(BRegistrarCambios, javax.swing.GroupLayout.PREFERRED_SIZE, 223, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addGap(148, 148, 148))))
        );
        PanelDatosEstudianteLayout.setVerticalGroup(
            PanelDatosEstudianteLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(PanelDatosEstudianteLayout.createSequentialGroup()
                .addContainerGap()
                .addGroup(PanelDatosEstudianteLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel25)
                    .addComponent(CTDNIEstudiante, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(PanelDatosEstudianteLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel1)
                    .addComponent(CTNomEstudiante, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addGroup(PanelDatosEstudianteLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel16)
                    .addComponent(CTApellidoEstudiante, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addGroup(PanelDatosEstudianteLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel17)
                    .addComponent(CTTelefonoEstudiante, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(jLabel24, javax.swing.GroupLayout.PREFERRED_SIZE, 13, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(PanelDatosEstudianteLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                    .addComponent(jLabel15)
                    .addGroup(PanelDatosEstudianteLayout.createSequentialGroup()
                        .addGroup(PanelDatosEstudianteLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                            .addComponent(jLabel18)
                            .addGroup(PanelDatosEstudianteLayout.createSequentialGroup()
                                .addGroup(PanelDatosEstudianteLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                                    .addComponent(jLabel19)
                                    .addComponent(jLabel20)
                                    .addComponent(jLabel21))
                                .addGap(4, 4, 4)
                                .addGroup(PanelDatosEstudianteLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                                    .addComponent(CBAno, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                                    .addComponent(CBMes, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                                    .addComponent(CBDia, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(CTDireccionEstudiante, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 69, Short.MAX_VALUE)
                .addComponent(BRegistrarCambios)
                .addContainerGap())
        );

        jTabbedPane1.addTab("Datos de estudiante", PanelDatosEstudiante);

        PanelGeneralDatos.setBorder(javax.swing.BorderFactory.createTitledBorder(null, "Otros datos", javax.swing.border.TitledBorder.DEFAULT_JUSTIFICATION, javax.swing.border.TitledBorder.DEFAULT_POSITION, new java.awt.Font("Tahoma", 0, 11), new java.awt.Color(0, 0, 153))); // NOI18N

        PanelDatosMadre.setBorder(javax.swing.BorderFactory.createTitledBorder(null, "Datos de la madre", javax.swing.border.TitledBorder.DEFAULT_JUSTIFICATION, javax.swing.border.TitledBorder.DEFAULT_POSITION, new java.awt.Font("Tahoma", 0, 11), new java.awt.Color(0, 0, 153))); // NOI18N

        jLabel10.setText("Nombre de la Madre:");

        jLabel11.setText("Apellidos de la Madre:");

        jLabel12.setText("Documento de la Madre:");

        jLabel13.setText("Teléfono de la Madre:");

        BRegistrarMadre.setFont(new java.awt.Font("Tahoma", 1, 11)); // NOI18N
        BRegistrarMadre.setText("Registrar");
        BRegistrarMadre.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                BRegistrarMadreActionPerformed(evt);
            }
        });

        javax.swing.GroupLayout PanelDatosMadreLayout = new javax.swing.GroupLayout(PanelDatosMadre);
        PanelDatosMadre.setLayout(PanelDatosMadreLayout);
        PanelDatosMadreLayout.setHorizontalGroup(
            PanelDatosMadreLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(PanelDatosMadreLayout.createSequentialGroup()
                .addGroup(PanelDatosMadreLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(jLabel12)
                    .addComponent(jLabel13)
                    .addComponent(jLabel11)
                    .addComponent(jLabel10))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(PanelDatosMadreLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(CTDNIMadre, javax.swing.GroupLayout.DEFAULT_SIZE, 294, Short.MAX_VALUE)
                    .addComponent(CTApellidosMadre, javax.swing.GroupLayout.DEFAULT_SIZE, 294, Short.MAX_VALUE)
                    .addComponent(CTTelefonoMadre, javax.swing.GroupLayout.DEFAULT_SIZE, 294, Short.MAX_VALUE)
                    .addComponent(CTNomMadre, javax.swing.GroupLayout.DEFAULT_SIZE, 294, Short.MAX_VALUE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 14, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addComponent(BRegistrarMadre)
                .addContainerGap())
        );
        PanelDatosMadreLayout.setVerticalGroup(
            PanelDatosMadreLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(PanelDatosMadreLayout.createSequentialGroup()
                .addGroup(PanelDatosMadreLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(PanelDatosMadreLayout.createSequentialGroup()
                        .addGap(26, 26, 26)
                        .addGroup(PanelDatosMadreLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(jLabel11)
                            .addComponent(CTApellidosMadre, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addGroup(PanelDatosMadreLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(jLabel12)
                            .addComponent(CTDNIMadre, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)))
                    .addGroup(PanelDatosMadreLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                        .addComponent(jLabel10)
                        .addComponent(CTNomMadre, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(PanelDatosMadreLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel13)
                    .addComponent(CTTelefonoMadre, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(BRegistrarMadre)))
        );

        PanelDatosPadre.setBorder(javax.swing.BorderFactory.createTitledBorder(null, "Datos del padre", javax.swing.border.TitledBorder.DEFAULT_JUSTIFICATION, javax.swing.border.TitledBorder.DEFAULT_POSITION, new java.awt.Font("Tahoma", 0, 11), new java.awt.Color(0, 0, 153))); // NOI18N

        jLabel6.setText("Nombre del Padre:");

        jLabel7.setText("Apellidos del Padre:");

        jLabel8.setText("Documento del Padre:");

        jLabel9.setText("Teléfono del Padre:");

        BRegistrarPadre.setFont(new java.awt.Font("Tahoma", 1, 11)); // NOI18N
        BRegistrarPadre.setText("Registrar");
        BRegistrarPadre.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                BRegistrarPadreActionPerformed(evt);
            }
        });

        javax.swing.GroupLayout PanelDatosPadreLayout = new javax.swing.GroupLayout(PanelDatosPadre);
        PanelDatosPadre.setLayout(PanelDatosPadreLayout);
        PanelDatosPadreLayout.setHorizontalGroup(
            PanelDatosPadreLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(PanelDatosPadreLayout.createSequentialGroup()
                .addGroup(PanelDatosPadreLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(jLabel7)
                    .addComponent(jLabel6)
                    .addComponent(jLabel8)
                    .addComponent(jLabel9))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(PanelDatosPadreLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(CTDNIPadre, javax.swing.GroupLayout.DEFAULT_SIZE, 305, Short.MAX_VALUE)
                    .addComponent(CTApellidosPadre, javax.swing.GroupLayout.DEFAULT_SIZE, 305, Short.MAX_VALUE)
                    .addComponent(CTTelefonoPadre, javax.swing.GroupLayout.DEFAULT_SIZE, 305, Short.MAX_VALUE)
                    .addComponent(CTNomPadre, javax.swing.GroupLayout.DEFAULT_SIZE, 305, Short.MAX_VALUE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 14, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addComponent(BRegistrarPadre)
                .addContainerGap())
        );
        PanelDatosPadreLayout.setVerticalGroup(
            PanelDatosPadreLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(PanelDatosPadreLayout.createSequentialGroup()
                .addGroup(PanelDatosPadreLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel6)
                    .addComponent(CTNomPadre, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(PanelDatosPadreLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(CTApellidosPadre, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jLabel7))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(PanelDatosPadreLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel8)
                    .addComponent(CTDNIPadre, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(PanelDatosPadreLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel9)
                    .addComponent(CTTelefonoPadre, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(BRegistrarPadre)))
        );

        javax.swing.GroupLayout PanelGeneralDatosLayout = new javax.swing.GroupLayout(PanelGeneralDatos);
        PanelGeneralDatos.setLayout(PanelGeneralDatosLayout);
        PanelGeneralDatosLayout.setHorizontalGroup(
            PanelGeneralDatosLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, PanelGeneralDatosLayout.createSequentialGroup()
                .addContainerGap()
                .addGroup(PanelGeneralDatosLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                    .addComponent(PanelDatosMadre, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                    .addComponent(PanelDatosPadre, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
                .addContainerGap())
        );
        PanelGeneralDatosLayout.setVerticalGroup(
            PanelGeneralDatosLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(PanelGeneralDatosLayout.createSequentialGroup()
                .addComponent(PanelDatosPadre, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(PanelDatosMadre, javax.swing.GroupLayout.DEFAULT_SIZE, 177, Short.MAX_VALUE))
        );

        jTabbedPane1.addTab("Datos de los padres de estudiante", PanelGeneralDatos);

        jLabel5.setText("Estudiante:");

        CBSelecEstudiante.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                CBSelecEstudianteActionPerformed(evt);
            }
        });

        jLabel14.setText("Seleccione un estudiante de la lista y presione \"Seleccionar\"");

        BDeshacer.setFont(new java.awt.Font("Tahoma", 1, 11)); // NOI18N
        BDeshacer.setText("Deshacer cambios");
        BDeshacer.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                BDeshacerActionPerformed(evt);
            }
        });

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
        getContentPane().setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(jTabbedPane1)
                    .addGroup(layout.createSequentialGroup()
                        .addComponent(jLabel14)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(jLabel23, javax.swing.GroupLayout.DEFAULT_SIZE, 203, Short.MAX_VALUE)
                        .addGap(79, 79, 79))
                    .addGroup(layout.createSequentialGroup()
                        .addComponent(BCancelar)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 357, Short.MAX_VALUE)
                        .addComponent(BDeshacer))
                    .addGroup(layout.createSequentialGroup()
                        .addComponent(jLabel5)
                        .addGap(18, 18, 18)
                        .addComponent(CBSelecEstudiante, 0, 500, Short.MAX_VALUE)))
                .addContainerGap())
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel5)
                    .addComponent(CBSelecEstudiante, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel14)
                    .addComponent(jLabel23, javax.swing.GroupLayout.PREFERRED_SIZE, 16, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addComponent(jTabbedPane1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(BCancelar)
                    .addComponent(BDeshacer))
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
        );

        pack();
    }// </editor-fold>//GEN-END:initComponents

    private void BCancelarActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_BCancelarActionPerformed
        // TODO add your handling code here:
        this.setVisible(false);
    }//GEN-LAST:event_BCancelarActionPerformed

    private void BRegistrarMadreActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_BRegistrarMadreActionPerformed
        estudiantebo = new EstudianteBL();
        //procesa la fecha ingresada a String

//        if (estudiantebo.actualizarDatosDeMadre(documentoestudiante,
//                this.CTNomMadre.getText(),
//                this.CTApellidosMadre.getText(),
//                this.CTDNIMadre.getText(),
//                this.CTTelefonoMadre.getText())) {
//            JOptionPane.showConfirmDialog(this,
//                    "Se han actualizado correctamente los datos de la madre del(la) estudiante",
//                    "Operacion exitosa",
//                    JOptionPane.OK_OPTION);
//        }
    }//GEN-LAST:event_BRegistrarMadreActionPerformed

    private void BRegistrarCambiosActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_BRegistrarCambiosActionPerformed
        estudiantebo = new EstudianteBL();
        //procesa la fecha ingresada a String
        String fnacimiento = new String(this.CBAno.getSelectedItem().toString() + "/"
                + String.valueOf(this.CBMes.getSelectedIndex() + 1) + "/"
                + this.CBDia.getSelectedItem().toString());

        if (this.CTNomEstudiante.getText().equals("")
                || this.CTApellidoEstudiante.getText().equals("")
                || this.CTTelefonoEstudiante.getText().equals("")
                || this.CTDireccionEstudiante.getText().equals("")
                || this.CTDNIEstudiante.getText().equals("")) {
//            if (estudiantebo.actualizarDatosPersonales(this.documentoestudiante,
//                    this.CTDNIEstudiante.getText(),
//                    this.CTNomEstudiante.getText(),
//                    this.CTApellidoEstudiante.getText(),
//                    this.CTTelefonoEstudiante.getText(),
//                    fnacimiento,
//                    this.CTDireccionEstudiante.getText())) {
//                JOptionPane.showConfirmDialog(this,
//                        "Se han actualizado correctamente los datos personales del(la) estudiante",
//                        "Operacion exitosa",
//                        JOptionPane.OK_OPTION);
//            }
        } else {
            JOptionPane.showConfirmDialog(this,
                    "En esta pestaña no pueden haber campos vacios\n\n"
                    + "Si necesita deshacer los cambios que no hayan sido\n\n"
                    + "registrados presione el boton \"deshacer cambios\"",
                    "Advertencia",
                    JOptionPane.OK_OPTION);
        }

    }//GEN-LAST:event_BRegistrarCambiosActionPerformed

    private void CTDireccionEstudianteActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_CTDireccionEstudianteActionPerformed
        // TODO add your handling code here:
    }//GEN-LAST:event_CTDireccionEstudianteActionPerformed

    private void BRegistrarPadreActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_BRegistrarPadreActionPerformed
        estudiantebo = new EstudianteBL();
        //procesa la fecha ingresada a String
//
//        if (estudiantebo.actualizarDatosDePadre(documentoestudiante,
//                this.CTNomPadre.getText(),
//                this.CTApellidosPadre.getText(),
//                this.CTDNIPadre.getText(),
//                this.CTTelefonoPadre.getText())) {
//            JOptionPane.showConfirmDialog(this,
//                    "Se han actualizado correctamente los datos del padre del(la) estudiante",
//                    "Operacion exitosa",
//                    JOptionPane.OK_OPTION);
//        }

    }//GEN-LAST:event_BRegistrarPadreActionPerformed

    private void BDeshacerActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_BDeshacerActionPerformed
    }//GEN-LAST:event_BDeshacerActionPerformed

    private void CBSelecEstudianteActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_CBSelecEstudianteActionPerformed

        this.jLabel23.setText("Cargando datos...");

        Estudiante estudiante = null;
        estudiantebo = new EstudianteBL();


        if (this.CBSelecEstudiante.getSelectedItem() == null) {
            JOptionPane.showConfirmDialog(this,
                    "No ha seleccionado un estudiante!!!",
                    "Cuidado",
                    JOptionPane.WARNING_MESSAGE);
        } else {
            String temp = new String(this.CBSelecEstudiante.getSelectedItem().toString());
            StringTokenizer stringtokenizertemp = new StringTokenizer(temp, " ");
            long docidentidadtemp = Long.valueOf(stringtokenizertemp.nextToken());
            try {
//                estudiante = estudiantebo.obtenerEstudiantePorDocumento(docidentidadtemp);
            } catch (java.lang.NumberFormatException e) {
                JOptionPane.showMessageDialog(this,
                        "El campo de busqueda documento debe ser un numero entero no negativo",
                        "Error",
                        JOptionPane.OK_OPTION);
            } catch (javax.persistence.NoResultException e) {
                JOptionPane.showMessageDialog(this,
                        "No se han encontrado estudiantes con ese numero de documento",
                        "Error",
                        JOptionPane.OK_OPTION);
            }
//            if (estudiantebo.obtenerEstudiantePorDocumento(docidentidadtemp) != null) {
//                this.documentoestudiante = estudiante.getDocEstudiante();
//                this.CTDNIEstudiante.setText(String.valueOf(estudiante.getDocEstudiante()));
//                this.CTNomEstudiante.setText(estudiante.getNombreEst());
//                this.CTApellidoEstudiante.setText(estudiante.getApellidoEst());
//                this.CTTelefonoEstudiante.setText(String.valueOf(estudiante.getTelefonoEst()));
//                this.CTDireccionEstudiante.setText(String.valueOf(estudiante.getDireccionEst()));
                //carga los datos de padres en la interfaz
//                this.CTNomPadre.setText(estudiante.getNombrePadre());
//                this.CTApellidosPadre.setText(estudiante.getApellidoPadre());
//                this.CTDNIPadre.setText(String.valueOf(estudiante.getDocPadre()));

//                if (estudiante.getTelPadre() == -1) {
//                    this.CTTelefonoPadre.setText("Aun no se ha registrado");
//                } else {
//                    this.CTTelefonoPadre.setText(String.valueOf(estudiante.getTelPadre()));
//                }
//
//                this.CTNomMadre.setText(estudiante.getNombreMadre());
//                this.CTApellidosMadre.setText(estudiante.getApellidoMadre());
//                this.CTDNIMadre.setText(String.valueOf(estudiante.getDocMadre()));
//                if (estudiante.getTelMadre() == -1) {
//                    this.CTTelefonoMadre.setText("Aun no se ha registrado");
//                } else {
//                    this.CTTelefonoMadre.setText(String.valueOf(estudiante.getTelMadre()));
//                }
//                this.jLabel23.setText("");
////                this.jLabel24.setText(estudiante.getFechaNacimientoEst());
//            } else {
//                System.out.println("apuntador nulo");
//            }
//        }
    }//GEN-LAST:event_CBSelecEstudianteActionPerformed

    /**
     * @param args the command line arguments
     */
//    public static void main(String args[]) {
//        java.awt.EventQueue.invokeLater(new Runnable() {
//
//            public void run() {
//                new InterfazEditarEstudiante().setVisible(true);
//            }
//        });
   }
    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JButton BCancelar;
    private javax.swing.JButton BDeshacer;
    private javax.swing.JButton BRegistrarCambios;
    private javax.swing.JButton BRegistrarMadre;
    private javax.swing.JButton BRegistrarPadre;
    private javax.swing.JComboBox CBAno;
    private javax.swing.JComboBox CBDia;
    private javax.swing.JComboBox CBMes;
    private javax.swing.JComboBox CBSelecEstudiante;
    private javax.swing.JTextField CTApellidoEstudiante;
    private javax.swing.JTextField CTApellidosMadre;
    private javax.swing.JTextField CTApellidosPadre;
    private javax.swing.JTextField CTDNIEstudiante;
    private javax.swing.JTextField CTDNIMadre;
    private javax.swing.JTextField CTDNIPadre;
    private javax.swing.JTextField CTDireccionEstudiante;
    private javax.swing.JTextField CTNomEstudiante;
    private javax.swing.JTextField CTNomMadre;
    private javax.swing.JTextField CTNomPadre;
    private javax.swing.JTextField CTTelefonoEstudiante;
    private javax.swing.JTextField CTTelefonoMadre;
    private javax.swing.JTextField CTTelefonoPadre;
    private javax.swing.JPanel PanelDatosEstudiante;
    private javax.swing.JPanel PanelDatosMadre;
    private javax.swing.JPanel PanelDatosPadre;
    private javax.swing.JPanel PanelGeneralDatos;
    private javax.swing.JLabel jLabel1;
    private javax.swing.JLabel jLabel10;
    private javax.swing.JLabel jLabel11;
    private javax.swing.JLabel jLabel12;
    private javax.swing.JLabel jLabel13;
    private javax.swing.JLabel jLabel14;
    private javax.swing.JLabel jLabel15;
    private javax.swing.JLabel jLabel16;
    private javax.swing.JLabel jLabel17;
    private javax.swing.JLabel jLabel18;
    private javax.swing.JLabel jLabel19;
    private javax.swing.JLabel jLabel20;
    private javax.swing.JLabel jLabel21;
    private javax.swing.JLabel jLabel23;
    private javax.swing.JLabel jLabel24;
    private javax.swing.JLabel jLabel25;
    private javax.swing.JLabel jLabel5;
    private javax.swing.JLabel jLabel6;
    private javax.swing.JLabel jLabel7;
    private javax.swing.JLabel jLabel8;
    private javax.swing.JLabel jLabel9;
    private javax.swing.JTabbedPane jTabbedPane1;
    // End of variables declaration//GEN-END:variables
}
